<cfscript>
	param name="FORM.username" default="";

	ret = StructNew();
	StructInsert(ret, "username", FORM.username);
	StructInsert(ret, "message", "Username available");
	StructInsert(ret, "valid", true);

	myscf = CreateObject("myscf.model.myscf");
	try { myscf.setUsername(FORM.username); }
	catch(any e){
		StructUpdate(ret, "message", e.message);
		StructUpdate(ret, "valid", false);
	}

	getPageContext().getResponse().setContentType('application/json');
	writeOutput(SerializeJSON(ret));
</cfscript>